#include <stdio.h>
#include <unistd.h>

int main()
{
	int mypid,fork_rv;

	mypid = getpid();
	printf("Before: my pid is %d\n",mypid);
	
	fork_rv = fork();
	
	if (fork_rv == -1){
		perror("fork");
	}
	else if (fork_rv == 0){
		printf("I am a child,my pid = %d\n",getpid());
	}
	else{
		printf("I am a parent,my child is %d\n",fork_rv);
	}

	return 0;
}

	
